var twoSum = function (num1 = [1, 1, 1, 1, 1], num2 = [2, 2, 2]) {
    len1 = num1.length;
    len2 = num2.length;
    let maxlen;
    let minlen;
    let array = [];
    len1 > len2 ? maxlen = len1 : maxlen = len2;
    len1 < len2 ? minlen = len1 : minlen = len2;
    for (let i = 0; i < maxlen; i++) {
        if (num1[i] && num2[i]) {
            let temp = num1[i] + num2[i];
            if (temp>=10) {
                array.push(temp%10);
            } else {
                
            }
            array.push(temp);
        }
    }
    for (let i = minlen; i < maxlen; i++) {
        if (num1[i] === undefined) {
            array.push(num2[i])
        } else {
            array.push(num1[i])
        }
    }
    console.log(array)
};
twoSum()